/**
 * WithdrawType.java 
 * Copyright © 2009-2014, Liu Tao
 * 
 * @author Liu Tao
 * @create 2015年5月9日
 */
package com.pshare.artemis.common.enums;

import java.util.HashMap;
import java.util.Map;

/**
 * 上传图片目录结构类型
 */
public enum BxImgUpType {

	AVATAR(1, "avatar"),
	IDEETITY(2,"identity"), 
	DRIVING_CARD(3,"driving_card"),
	BACK_LOT(4,"back_lot"),//后台上传停车场图片
	BACK_PLAN(5,"back_plan"),//后台上传平面图
	BACK_LOTMAP(6,"back_lotmap"),//后台上传室内图
	BACK_AD(7,"back_lotmap");//后台上传广告
	private int code;
	private String name;
	
	private BxImgUpType(int code, String name) {
		this.code = code;
		this.name = name;
	}

	public static Boolean codeOf(Integer code) {
		for (BxImgUpType payType : BxImgUpType.values()) {
			if (new Integer(payType.getCode()).equals(code)) {
				return true;
			}
		}
		return false;
	}

	public static String getName(int code) {
		for (BxImgUpType enumData : BxImgUpType.values()) {
			if (enumData.getCode() == code) {
				return enumData.getName();
			}
		}
		return "";
	}
	
	public static Map<Integer, String> getAll() {
		Map<Integer, String> map = new HashMap<Integer, String>();
		for (BxImgUpType em : BxImgUpType.values()) {
			Integer code = em.getCode();
			map.put(code, em.getName(code));
		}
		return map;
	}

	public int getCode() {
		return code;
	}

	public void setCode(int code) {
		this.code = code;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

}
